/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dwh.trigger;

import java.io.FileInputStream;
import java.io.IOException;
import static org.dwh.trigger.Log.info;


/**
 *
 * @author Jose Carlos Palma
 * @version 1.0
 */
public class Main {

    /**
     * @param args Los argumentos de linea de comando
     */
    public static void main(String[] args) {

        try {
            System.getProperties().load(new FileInputStream("trigger.conf"));
        } catch (IOException ex) {
            
        }        

        final Server server = new Server();


        Runtime.getRuntime().addShutdownHook(new Thread() {

            @Override
            public void run() {
                info("TriggerServer is shutting down...");
                
                    server.turnOff();
                    while (!server.isShutdown()) {
                        try {
                            sleep(500);
                        } catch (InterruptedException ex) {
                        }
                    }
                
                info(" *** TriggerServer is shutdown ***");
            }
        });


        server.start();

    }
}
